package com.ruoyi.monitor.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SNUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.monitor.mapper.MonitorConfigMapper;
import com.ruoyi.monitor.domain.MonitorConfig;
import com.ruoyi.monitor.service.IMonitorConfigService;

/**
 * 监测配置Service业务层处理
 * 
 * @author weihanqiang
 * @date 2025-04-30
 */
@Service
public class MonitorConfigServiceImpl implements IMonitorConfigService 
{
    @Autowired
    private SNUtil snUtil;

    @Autowired
    private MonitorConfigMapper monitorConfigMapper;

    /**
     * 查询监测配置
     * 
     * @param monitorConfigId 监测配置主键
     * @return 监测配置
     */
    @Override
    public MonitorConfig selectMonitorConfigByMonitorConfigId(Long monitorConfigId)
    {
        return monitorConfigMapper.selectMonitorConfigByMonitorConfigId(monitorConfigId);
    }

    /**
     * 查询监测配置列表
     * 
     * @param monitorConfig 监测配置
     * @return 监测配置
     */
    @Override
    public List<MonitorConfig> selectMonitorConfigList(MonitorConfig monitorConfig)
    {
        return monitorConfigMapper.selectMonitorConfigList(monitorConfig);
    }

    /**
     * 新增监测配置
     * 
     * @param monitorConfig 监测配置
     * @return 结果
     */
    @Override
    public int insertMonitorConfig(MonitorConfig monitorConfig)
    {
        String monitor_config_no = snUtil.generateSN("monitor_config", "monitor_config_no", "yyyyMMdd", "MC", 4);
        monitorConfig.setMonitorConfigNo(monitor_config_no);
        monitorConfig.setCreateTime(DateUtils.getNowDate());
        return monitorConfigMapper.insertMonitorConfig(monitorConfig);
    }

    /**
     * 修改监测配置
     * 
     * @param monitorConfig 监测配置
     * @return 结果
     */
    @Override
    public int updateMonitorConfig(MonitorConfig monitorConfig)
    {
        return monitorConfigMapper.updateMonitorConfig(monitorConfig);
    }

    /**
     * 批量删除监测配置
     * 
     * @param monitorConfigIds 需要删除的监测配置主键
     * @return 结果
     */
    @Override
    public int deleteMonitorConfigByMonitorConfigIds(Long[] monitorConfigIds)
    {
        return monitorConfigMapper.deleteMonitorConfigByMonitorConfigIds(monitorConfigIds);
    }

    /**
     * 删除监测配置信息
     * 
     * @param monitorConfigId 监测配置主键
     * @return 结果
     */
    @Override
    public int deleteMonitorConfigByMonitorConfigId(Long monitorConfigId)
    {
        return monitorConfigMapper.deleteMonitorConfigByMonitorConfigId(monitorConfigId);
    }
}
